package com.wanggan.rmi;

import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;

import com.wanggan.rmi.service.HelloService;
import com.wanggan.rmi.service.impl.HelloServiceImpl;
import com.wanggan.rmi.service.impl.UserServiceImpl;
import com.wanggan.rmi.util.RegistryUtil;

/**
 * @author wanggan
 */

//@SpringBootApplication
public class RmiServer {
    public static void main(String[] args) {
        Registry registry = RegistryUtil.getRegistry();
        try {
            registry.rebind("UserService",new UserServiceImpl());
        } catch (RemoteException e) {
            e.printStackTrace();
        }

//        try {
//            HelloService service1 = new HelloServiceImpl("service1");
//            registry.rebind("HelloService1", service1); //HelloServer就是对外暴露出的名称
//            System.out.println("Successfully register a remote object.");
//        } catch (Exception e) {
//            e.printStackTrace();
//        }
    
    }
    
}
